<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        let str = ""
        let str = new String()
        //1.执行函数 2.自动创建一个空对象 3.把空对象和this绑定 4.如果没有返还，隐士返还this
        function test() {
            console.log("test")
        }
        test()
        new test()
        new test

        function Test() {
            let obj = {} // === this
            return this
        }
         new Test()


         function Person(name,age,hobby){
            //let obj = {} //添加原料 === this
            this.name = name
            this.age = age
            this.hobby = function(){
                console.log(hobby)
            }
            //加工原料
            //return obj //出厂
         }

         let zhangsan  = new Person("张三",20,"篮球")
         console.log(zhangsan.name)
         zhangsan.hobby()
    </script>
</body>

</html>